Clean up the 'initial mapping' area properly on x86/64.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 28 Oct 2005 16:11:59 +0000 (17:11 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 28 Oct 2005 16:11:59 +0000 (17:11 +0100)
We must completely blow away mappings of the original
p2m table and the initrd. Those areas eventually get freed
to the memory allocator and other uses of that memory will
get really confused by spurious redundant mappings in the
init mapping area.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c

index 9c51a4f270061ea72f05940eeec9623044fd9888..01737755422e290e7b280fc6ff72db303a8b240d 100644 (file)
@@ -733,6 +733,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_XEN
        {
                int i, j, k, fpp;
+               unsigned long va;
 
                /* Make sure we have a large enough P->M table. */
                phys_to_machine_mapping = alloc_bootmem(
@@ -746,9 +747,21 @@ void __init setup_arch(char **cmdline_p)
                        __pa(xen_start_info->mfn_list), 
                        PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
                                        sizeof(unsigned long))));
-               make_pages_readonly((void *)xen_start_info->mfn_list,
-                                   PFN_UP(xen_start_info->nr_pages *
-                                          sizeof(unsigned long)));
+
+               /* 'Initial mapping' of old p2m table must be destroyed. */
+               for (va = xen_start_info->mfn_list;
+                    va < (xen_start_info->mfn_list +
+                          (xen_start_info->nr_pages*sizeof(unsigned long)));
+                    va += PAGE_SIZE) {
+                       HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
+               }
+
+               /* 'Initial mapping' of initrd must be destroyed. */
+               for (va = xen_start_info->mod_start;
+                    va < (xen_start_info->mod_start+xen_start_info->mod_len);
+                    va += PAGE_SIZE) {
+                       HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
+               }
 
                /* 
                 * Initialise the list of the frames that specify the list of